
export function goodsList(pageIndex) {
	return new Promise((resolve, reject) => {
		uni.request({
			url: 'uni-app/list-of-goods/list',
			data: {
				pageIndex: pageIndex
			},
			success(res) {
				resolve(res.data);
			},
			fail: (err) => {
				reject(err);
			}
		})
	})
}

export function carts() {
	return new Promise((resolve, reject) => {
		uni.request({
			url: 'uni-app/shopping-carts/list',
			success(reqs) {
				resolve(reqs.data);
			},
			fail: (err) => {
				reject(err);
			}
		})

	})
}

export function single(shopId,shopFig,value){
	return new Promise((resolve,reject)=>{
		uni.request({
			url:'uni-app/shopping-carts/update',
			data:{
				"shopId":shopId,
				"shopFig":shopFig,
				"shopNumber":value
			},
			success(res) {
				resolve(res.data)
			},fail(err) {
				reject(err)
			}
		})
	})
}

export function deleteShopId(shopId){
	return new Promise((resolve,reject)=>{
		uni.request({
			url:'uni-app/shopping-carts/delete',
			data:{
				"shopId":shopId
			},
			success(res) {
				resolve(res.data)
			},
			fail() {
				reject(err);
			}
		})
	})
}

export function userId(){
	return new Promise((resolve,reject)=>{
		uni.request({
			url:'uni-app/sys-user/isLogins',
			success(res) {
				resolve(res.data);
			},
			fail(err) {
				reject(err);
			}
		})
	})
}

export function checkOutShop(){
	return new Promise((resolve,reject)=>{
		uni.request({
			url:'uni-app/shopping-carts/checkOut',
			success(res) {
				resolve(res.data)
			},
			fail(err) {
				reject(err);
			}
		})
	})
}